Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Defining an IF-THEN-ELSE decision point

You’ll notice when you run your procedure that some of the ship dates aren’t defined. Some of these Orders apparently have been on hold for a very long time! Let’s construct a statement to branch in the code depending on whether the ShipDate field is defined or not. The 4GL, like most languages, has an IF-THEN construct for such decision points. It can also have an ELSE branch:

IF condition THEN { block | statement } [ ELSE { block | statement } ] 

The condition is any expression that evaluates to true or false. Following the THEN keyword, you can place a single 4GL statement or a whole set of statements that are all to be executed if the condition is true. The way to represent a block that simply groups a series of statements together that are all executed together is a DO-END block:

IF condition THEN 
DO: 
    statement 
    . 
    . 
    . 
END. 

If you include the ELSE keyword followed by a statement or a block of statements, that branch is taken if the condition evaluates to false.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095